package main

import (
	"AdapterPattern/Adapter"
	"fmt"
)

func main() {
	var americanSocket = Adapter.AmericanSocket{}
	var chineseSocket = Adapter.ChineseSocket{}

	var chinesePlug = Adapter.ChinesePlug{}
	var americanPlug = Adapter.AmericanPlug{}

	chinesePlug.UseChineseSocket(&americanSocket)
	chinesePlug.UseChineseSocket(&chineseSocket)

	americanPlug.UseAmericanSocket(&americanSocket)
	americanPlug.UseAmericanSocket(&chineseSocket)

	fmt.Println("使用国标转美标转换器：")
	var chineseToAmericanAdapter = Adapter.ChineseToAmericanAdapter{}
	chineseToAmericanAdapter.SetSocket(&chineseSocket)
	americanPlug.UseAmericanSocket(&chineseToAmericanAdapter)

	fmt.Println("使用美标转国标转换器：")
	var americanToChineseAdapter = Adapter.AmericanToChineseAdapter{}
	americanToChineseAdapter.SetSocket(&americanSocket)
	chinesePlug.UseChineseSocket(&americanToChineseAdapter)
}
